//Wrong
//20 4WA
#include"bits/stdc++.h"
using namespace std;
int m,n,x,sw[10000][5],g[100],g1,h;
int main()
{
	int j;
	cin>>m>>n>>x;
	for(int i=m;i<=n;i++)
	{
		j=i;
		while(j)
		{
			sw[i][g[g1]]=j%10;
			j/=10;
			g[g1]+=1;
		}
		g1+=1;
	}
	for(int i=m;i<=n;i++)
	{
		for(int k=0;k<=g1;k++)
		{
			if(sw[i][g[k]]==x)
			{
				h+=1;
			}
		}
	}
	cout<<h;
}
